<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import= "org.json.util.JSONUtil" %>
<%@page import="com.ufgov.gmap.context.ApplusContext"%>
<%@page import="com.ufgov.gmap.domain.service.DomainService"%>

<%
String path = request.getContextPath();
String result = (String) request.getAttribute("result");
	if(result == null){
		result = "";
	}else{
		result = "* " + result;
	}
	boolean flag = false;
	String userId = (String)session.getAttribute("svUserID");
	String userName = (String)session.getAttribute("svUserName");

	if(JSONUtil.hasStringValue(userId)){
		DomainService service = (DomainService)ApplusContext.getBean("domainService");
		Object user = service.getUser(userId);
		if(user != null){
			flag = true;
		}	
	}
%>
<html>
  <head>
    <title>用户登录</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
body{
	background:#f5f5f5;
}
.font01 {
	font-family: "Times New Roman", Times, serif;
	font-size: 12px;
	color: #000;
	line-height: 15px;
	} 
.tableGray{
	border: 1px solid #d8d8d8;
	background:#f5f5f5;
}
.textboxlogin { 
	margin: 0; 
	width: 90px;
	border: 1px solid #b3b3b3; 
	background: #FFF;
	color: #000; 
}
</style>

<script type="text/javascript">
   function doLogin(){
   	  document.form.submit();
   	  var loading_login=document.getElementById("loading_login");
   	  loading_login.style.display="block";
   	  var loading_form=document.getElementById("loading_form");
   	  loading_form.style.display="none";
   	}

	function doLogout(){
   	  document.logoutform.submit();
	   var loading_logout=document.getElementById("loading_logout");
   	  loading_logout.style.display="block";
   	  var loading_form2=document.getElementById("loading_form2");
   	  loading_form2.style.display="none";
	}
	
	function caLogin(){
		document.getElementById("common_tr_3").style.display="block";
		document.getElementById("common_tr_4").style.display="block";
		document.getElementById("common_tr_1").style.display="none";
		document.getElementById("common_tr_2").style.display="none";
		
	}
	
	function commonLogin(){
		document.getElementById("common_tr_3").style.display="none";
		document.getElementById("common_tr_4").style.display="none";
		document.getElementById("common_tr_1").style.display="block";
		document.getElementById("common_tr_2").style.display="block";
		
	}
	
	function doCALogin(){	
		  var loading_login=document.getElementById("loading_login");
   	  loading_login.style.display="block";
   	  var loading_form=document.getElementById("loading_form");
   	  loading_form.style.display="none";
   	  window.open ('CALogin.jsp','', 'toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=n o, status=no');
	}
</script> 
  
</head> 
<body>	
	    <table id="loading_login" style="display:none;"  width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    	 <tr>
    	 	  <td align="center" class="font01"><img src="/portal/skin/image/load.gif" style="position:relative;top:11px;"/><font size="4">正在登陆...</font></td>
    	</tr>
       </table>
	    <table id="loading_logout" style="display:none;"  width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    	 <tr>
    	 	  <td align="center" class="font01"><img src="/portal/skin/image/load.gif" style="position:relative;top:11px;"/><font size="4">正在注销...</font></td>
    	</tr>
       </table>
  <%
  	if(!flag){
  %>
  	<form id="form" name="form" action="memberLogin.action">
    <table id="loading_form" style="display:block;" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="5" colspan="3"><input type="hidden" id="url" name="url" value="memberLogin.jsp"/></td>
      </tr>
      <tr>
        <td class="font01" colspan="3" align="center">
        	<input type="radio" name="loginType"  checked="checked" onclick="commonLogin();"/>普通登录&nbsp;&nbsp;&nbsp;&nbsp;
        	<input type="radio" name="loginType"  onclick="caLogin();"/>CA登录
        </td>
      </tr>
      <tr>
        <td height="10" colspan="3"></td>
      </tr>      
      <tr id="common_tr_1" style="display:block;">
        <td class="font01" align="right">用户名：</td>
        <td><input name="username" type="text" class="textboxlogin" id="username"></td>
        <td><INPUT TYPE="image" src="<%=request.getContextPath()%>/skin/image/btnLogin.gif" onclick="doLogin();"></td>
      </tr>
      <tr id="common_tr_2" style="display:block;">
        <td class="font01" align="right">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
        <td><input name="password" type="password" class="textboxlogin" id="password"></td>
        <td style="display:none"><img src="<%=request.getContextPath()%>/skin/image/btnCA.gif" width="61" height="23"></td>
      </tr>
      <tr id="common_tr_3" style="display:none;">
        <td class="font01" align="left" colspan="3">请确保您的CA-key已经插在电脑上，然后点击【CA登录】进入西安政府采购平台 </td>
      </tr>    
      <tr id="common_tr_4" style="display:none;">
        <td align="center" colspan="3"><INPUT TYPE="image" src="<%=request.getContextPath()%>/skin/image/btnCA.gif" onclick="doCALogin();"></td>
      </tr>         
    </table>
  </form>
  <%
  	}else{
  %>
  <table id="loading_form2" style="display:block;" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="15"  class="font01">
        	欢迎：<b><%=userName%></b>
        </td>
      </tr>
	  <tr>
	     <td>&nbsp;</td>
	  </tr>
      <tr>
        <td class="font01">
  			<a href="portalDispatcher.action" class="font01" target="_blank">我的业务</a>&nbsp&nbsp|&nbsp&nbsp<a href="javascript:void(0);" class="font01" onclick="doLogout();">注销</a>
  		</td>
      </tr>
  <%
  	}
  %>
  <form id="logoutform" name="logoutform" action="sessionInvalidate_xa.jsp">
  </form>
</body>
</html>

